public class VFPage1Controller {

    public Decimal firstNumber { get; set; }
    public Decimal secondNumber { get; set; }
  
    Decimal result;
    public Decimal getResult(){
        return result;
    }
    
    public void setResult(Decimal value){
        result = value;
    }
     
    public VFPage1Controller(){
        firstNumber = 0;
        secondNumber = 0;
        result = 0;
    }    

    public PageReference add() {
        result = firstNumber + secondNumber;
        return null;
    }
}